package com.sangmo.fts.common.api;

import com.sangmo.boot.framework.api.utils.ApiResponse;
import com.sangmo.boot.framework.common.dict.DictionaryManager;
import com.sangmo.boot.framework.common.session.UserSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/common/v1")
public class CommonApi {

    @Autowired
    private DictionaryManager dictionaryManager;

    @PostMapping(value = "/dictionary")
    public @ResponseBody
    ApiResponse dictionary() {
        return ApiResponse.make(dictionaryManager.getDictionary(UserSession.getLocale().toLanguageTag()));
    }
}
